

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>　</title>

    <style>
        body {
            color: #000000;
            background-color: #ffffff;
        }

        .page {
            position: fixed;
            width: 100%;
            height: 100%;
        }

        .time_container,
        .date_container {
            width: 100%;
            margin: auto;
            text-align: center;
        }

        .time_container {
            top: 0;
            height: 20%;
        }

        .date_container {
            top: 0;
        }

        .time {
            padding-top: 2px;
            font-size: 7rem;
        }

        .date {
            padding-top: 50px;
            font-size: 3rem;
        }
        .date1 {
            padding-top: 50px;
            font-size: 2.4rem;
        }
        #wai{ width:400px; border:2px solid #900; padding:10px; overflow:hidden}
        .divleft{ float:left; width:50%;}
        .divright{ float:right; width:50%;}
    </style>
</head>

<body>
<div class="divleft">
    <div class="time_container">
        <div class="time" id="time">11:27</div>
    </div>
    <div class="date_container">
        <div class="date" id="date">1月10日</div>
        <div class="date" id="week">星期三</div>
    </div>
</div>
<div class="divright">


    <div class="date_container">
        <div class="date1" >温度：<text id="temperature">20</text></div>
        <div class="date1" >湿度：<text id="humidity">20</text></div>
    </div>
    <div class="date_container">
        <div class="date1" >天气：<text id="tianqi"></text></div>
    </div>
</div>

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    function update() {
        var date = new Date()
        var utc8DiffMinutes = date.getTimezoneOffset() + 480
        date.setMinutes(date.getMinutes() + utc8DiffMinutes)
        var timeString = date.getHours() + ':' + ('0' + date.getMinutes()).slice(-2)
        var dateString = (date.getMonth() + 1) + '月' + date.getDate() + '日'
        var weekList = ['日', '一', '二', '三', '四', '五', '六']
        var weekString = '星期' + weekList[date.getDay()]

        document.getElementById("time").innerHTML = timeString
        document.getElementById("date").innerHTML = dateString
        document.getElementById("week").innerHTML = weekString

        $.ajax({
            dataType: 'json',
            type: 'get',
            url: '/api/index/getth',
            data: '',
            success: function (json) {
                var data=json.data;
                $('#temperature').html(data.temperature);
                $('#humidity').html(data.humidity);
            },
            error: function (jqXHR, textStatus, errorThrown) {

            }
        });

        $.ajax({
            dataType: 'json',
            type: 'get',
            url: 'https://api2.jirengu.com/getWeather.php?city=%E9%BE%99%E5%B2%A9',
            data: '',
            success: function (json) {
                var data=json.result;
                console.log(data)
                $('#tianqi').html(data.now.text);
                // $('#humidity').html(data.humidity);
            },
            error: function (jqXHR, textStatus, errorThrown) {

            }
        });

    }

    update()
    setInterval("update()", 60 * 1000)
</script>
</body>
</html>